<?php
$cs=Yii::app()->clientScript;
$cs->registerCoreScript('jquery');
$dir = Yii::getPathOfAlias('ext.ueditor');
$baseUrl = Yii::app()->getAssetManager()->publish($dir);
$cs->registerScriptFile($baseUrl.'/editor_all.js',CClientScript::POS_HEAD );
$cs->registerScriptFile($this->createUrl('site/ueditor', array('_'=>md5(rand(),rand()))),CClientScript::POS_HEAD );
$dir = Yii::getPathOfAlias('ext.ueditor.themes.default');
$baseUrl = Yii::app()->getAssetManager()->publish($dir);
$cs->registerCssFile($baseUrl.'/ueditor.css');
$cs->registerScript('ueditor', 'var ue = new UE.ui.Editor();ue.render(\'Article_content\');', CClientScript::POS_READY);
?>
<div class="detailContent"  style="min-height: 1305px">
<form method="post" action="<?php echo $this->createUrl('manage/pxs');?>">
    <table>
        <tr>
            <td>标题</td>
        </tr>
        <tr>
            <td><input type="text" id="Article_title" class="text" name="Article[title]" /><span class="msg" id="msg">标题长度不超过30个字</span></td>
        </tr>
        <tr>
            <td>内容</td>
        </tr>
        <tr>
            <td><textarea style="width: 590px;" id="Article_content" name="Article[content]"></textarea></td>
        </tr>
        <tr>
            <td >
                <input id="button" type="submit" style="border: 0;height: 26px;" value="发布" onclick="return ck();" />
            </td>
        </tr>
    </table>

</form>
</div>
<script type="text/javascript">
    function ck(){
        if($('#Article_title').val().length>30){
            alert('标题不能超过30个字符');
            return false;
        }
        if($('#Article_title').val().length<1){
            alert('标题不能为空');
            return false;
        }
        if(!editor.hasContents()){
            alert('内容不能为空');
            return false;
        }
    }
</script>